package com.edu.zut.hb.software.server.service.impl;

import com.edu.zut.hb.software.server.pojo.RespBean;
import com.edu.zut.hb.software.server.pojo.registerVo.DefaultRegisterVo;
import com.edu.zut.hb.software.server.pojo.registerVo.StudentRegisterVo;
import com.edu.zut.hb.software.server.service.IStudentService;
import com.edu.zut.hb.software.server.service.RegisterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class RegisterServiceImpl implements RegisterService {
    @Autowired
    IStudentService studentService;

    @Override
    public RespBean registerStudent(StudentRegisterVo registerVo) {
        String username = registerVo.getUsername();
        String password = registerVo.getPassword();
        if (username.equals("") || username == null)
            return RespBean.error("用户名不能为空!");
        else if (password.equals("") || password == null)
            return RespBean.error("密码不能为空!");
        else {
            studentService.registerStudent(username, password);
            return RespBean.success("成功!");
        }

    }
}
